package com.spring.aop.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author liangd
 * date 2020-11-18 09:44
 * code  @Order指定事物优先级，数字越小，优先级越高
 * 再通知之前可以认证参数
 */
@Order(1)
@Aspect
@Component
public class ValidationAspect {

//    @Before("execution(* com.spring.aop.aspect.*.*(..)))")
    @Before("com.spring.aop.aspect.LoggingAspect.declareJoinPointExpress()")
    public void validateArgs(JoinPoint joinPoint){
        System.out.println("-->validate:"+ Arrays.asList(joinPoint.getArgs()));
    }
}
